﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Jxym.Tools.MyFile
{
    //7790:exe,8297:rar,8075:pk
    public class TypeTable
    {
        private string code;
        public string Code
        {
            get { return code; }
            set { code = value; }
        }
        private string typeName;
        public string TypeName
        {
            get { return typeName; }
            set { typeName = value; }
        }
    }
    public class MyFile
    {
        public string GetFileType(string sFileName)
        {
            System.IO.FileStream fs = new System.IO.FileStream(sFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            System.IO.BinaryReader r = new System.IO.BinaryReader(fs);
            string bx = " ";
            byte buffer;
            try
            {
                buffer = r.ReadByte();
                bx = buffer.ToString();
                buffer = r.ReadByte();
                bx += buffer.ToString();

            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
            r.Close();
            fs.Close();
            Console.WriteLine(bx);
            return bx;
        }
        private static ArrayList TypeTableList()
        {
            ArrayList typeList = new ArrayList();

            TypeTable typeTable = new TypeTable();

            typeTable.Code = "7790"; typeTable.TypeName = "EXE";
            typeList.Add(typeTable);
            typeTable.Code = "8297"; typeTable.TypeName = "RAR";
            typeList.Add(typeTable);
            typeTable.Code = "8075"; typeTable.TypeName = "PK";
            typeList.Add(typeTable);

            return typeList;
        }
    }
}
